package com.ckh.springboot.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ckh.springboot.controller.dto.UserPasswordDTO;
import com.ckh.springboot.entity.Goods;
import com.ckh.springboot.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ckh.springboot.vo.GetStudentClockInfoVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ckh
 * @since 2022-04-04
 */
public interface UserMapper extends BaseMapper<User> {

    @Update("update sys_user set password = #{newPassword} where username = #{username} and password = #{password}")
    int updatePassword(UserPasswordDTO userPasswordDTO);

    Page<User> findPage(Page<User> page,@Param("username") String username);

    @Select("select * from sys_user where username like #{username} order by jifen desc limit #{pageNum}, #{pageSize} ")
    List<User> selectPage(Integer pageNum, Integer pageSize, String username);

    List<GetStudentClockInfoVo> getStudentClockInfo(@Param("classId") Integer classId);

    Page<User> getUserList(Page<User> page,@Param("name") String name);
    @Select("select student_id from sys_user where id = #{id}")
    Integer getStudentId(Integer id);
}



